package com.spt.springbootzhsx.controller;

import com.spt.springbootzhsx.entity.back.MovieBack;
import com.spt.springbootzhsx.entity.data.FloatData;
import com.spt.springbootzhsx.service.SuggestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController
@RequestMapping(value="/suggest")
public class SuggestController {
    @Autowired
    private SuggestService suggestService;

    @GetMapping(value="/doSuggest")
    public String doSuggest(){
        return suggestService.doSuggest();
    }

    @GetMapping(value="/toRedis")
    public String toRedis(){
        return suggestService.toRedis();
    }

    @GetMapping(value="/getSuggestByUid/{uid}")
    public ArrayList<FloatData> getSuggestByUid(@PathVariable("uid") Integer uid){
        return suggestService.getSuggestByUid(uid);
    }

    @GetMapping(value="/getSuggestTop8ByUid/{uid}")
    public ArrayList<MovieBack> getSuggestTop8ByUid(@PathVariable("uid") Integer uid){
        return suggestService.getSuggestTop8(uid);
    }
}
